package com.lagou.controller;


import com.github.pagehelper.PageInfo;
import com.lagou.pojo.Article;
import com.lagou.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class MyController {

    @Autowired
    ArticleService articleService;

    @RequestMapping("/toIndexPage")
    public String toIndexPage(Model model, @RequestParam(defaultValue = "1")Integer
            pageNum){
        PageInfo<Article> page = articleService.mylist(pageNum,2);
        model.addAttribute("page", page);

        return "index";
    }


}
